/**
 * 
 */
package com.bestbuy.serviceimple;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.bestbuy.dao.CartDao;
import com.bestbuy.dao.ProductDao;
import com.bestbuy.pojo.Cart;
import com.bestbuy.pojo.CartDetail;
import com.bestbuy.service.CartService;

/**
 * @author Tuan
 *
 */
@Service
public class CartServiceImpl implements CartService{

	@Autowired
	private CartDao cartDAO;
	/* (non-Javadoc)
	 * @see com.bestbuy.service.CartService#getCart(java.lang.String)
	 */
	@Transactional
	public Cart getCart(String username) {
		return cartDAO.getCart(username);
	}
	/* (non-Javadoc)
	 * @see com.bestbuy.service.CartService#getCartDetail(java.lang.Integer)
	 */
	@Transactional
	public List<CartDetail> getCartDetail(Integer idCart) {
		// TODO Auto-generated method stub
		return cartDAO.getCartDetail(idCart);
	}
	/* (non-Javadoc)
	 * @see com.bestbuy.service.CartService#addToCart(java.lang.String, java.lang.Integer, java.lang.Integer)
	 */
	@Transactional
	public Boolean addToCart(String username, Integer idProduct,
			Integer quantity) {
		// TODO Auto-generated method stub
		return cartDAO.addToCart(username, idProduct, quantity);
	}
	/* (non-Javadoc)
	 * @see com.bestbuy.service.CartService#removeProduct(java.lang.String)
	 */
	@Transactional
	public Boolean removeProduct(String idCartDetail) {
		// TODO Auto-generated method stub
		return cartDAO.removeProduct(idCartDetail);
	}
	/* (non-Javadoc)
	 * @see com.bestbuy.service.CartService#updateProduct(java.lang.String, java.lang.String)
	 */
	@Transactional
	public Boolean updateProduct(String idCartDetail, String quantity) {
		
		return cartDAO.updateProduct(idCartDetail, quantity);
	}
	/* (non-Javadoc)
	 * @see com.bestbuy.service.CartService#saveBill(java.lang.String)
	 */
	@Transactional
	public Boolean saveBill(String username) {
		
		return cartDAO.saveBill(username);
	}
	/* (non-Javadoc)
	 * @see com.bestbuy.service.CartService#updateCart(com.bestbuy.pojo.Cart)
	 */
	@Transactional
	public void updateCart(Cart cart) {
		// TODO Auto-generated method stub
		cartDAO.updateCart(cart);
	}

}
